package com.yuneec.droneservice.command;

import com.yuneec.droneservice.request.IResponse;
import com.yuneec.droneservice.utils.ByteUtils;

/**
 * Created by gjw on 2017/3/27.
 */

public class SendMd5 extends BaseCommand {

    public SendMd5(String md5) {
        super(MAV_RC_COMMAND.MAV_RC_CMD_SEND_MD5);
        byte[] md5s = md5.getBytes();
        data = new byte[2 + md5s.length];
        ByteUtils.uShortToByteArray(data, 0, md5s.length, IS_BIGENDIAN);
        System.arraycopy(md5s, 0, data, 2, md5s.length);
    }


    @Override
    public IResponse toResponse(byte[] data, int off, int len) {
        int code = data[off + 1] & 0xff;
        return new IResponse(ids(), code);
    }
}
